<?php
 session_start();
      
    include ('../includes/config.php');
    
    include ('../includes/authenticate.php');
    
    include ('../includes/database.php');
    include ('../includes/user_header.php');
    
    //url example ...../event_edit.php?id=1
    $sql = "SELECT * FROM events WHERE id = '" . $_GET["id"]. "';";
    $result = mysql_query($sql)or die ("Error : " . mysql_error());
    $event  = mysql_fetch_assoc($result);
    
?>

<div class="container">
    <script>
     $(function(){
        var pickerOpts = {
            dateFormat:"yy-mm-dd" };  
        $("#datepicker").datepicker(pickerOpts);
     });

    </script>
    
    <form method="POST" action="<?php echo $__config['base_url'] ?>administrator/event_save.php?action=edit">
        <input type="hidden" value="<?php echo $event["id"]; ?>" name ="id" />
        
        <label> Nama Event </label>
        <input type="text" name="name" value =" <?php echo $event["name"] ?>"/>
        
        <label> Tempat </label>
        <input type="text" name="place" value =" <?php echo $event["place"] ?>"/>
        
        <label> Tanggal </label>
        <input type="text" name="date" id="datepicker" value =" <?php echo $event["date"] ?> "/>
        
        <label> Ringkasan Singkat Event </label>
        <textarea name="excerpt"> <?php echo $event["excerpt"]; ?> </textarea>
        
        <label> Ringkasan </label>
        <textarea name="description"> <?php echo $event["description"]; ?> </textarea>
        
        <br/>
        <input type="submit" class="btn" />
    </form>
</div>

<?php
     include ('../includes/user_footer.php');
?>
